//1. 安装 ejs
//2. 导入 ejs
const ejs = require('ejs');
const fs = require('fs');
//3. 准备数据
const data = [
    {
        id:1,
        name: 'gem',
        song: '野狼disco'
    },
    {
        id:2,
        name: '周杰伦',
        song: '不能说的密码'
    },
    {
        id:3,
        name:'林俊杰',
        song: '不为谁而作的歌'
    },
    {
        id:4,
        name: '五月天',
        song:'干杯'
    },
    {
        id: 5,
        name: '张艺兴',
        song: '莲'
    },
    {
        id:6,
        name:'刘德华',
        song:'冰雨'
    },
    {
        id: 7,
        name: '张学友',
        song: '情人'
    }
];
let html = fs.readFileSync('./table.html').toString();
//4. 解析
const result = ejs.render(html, {data});

console.log(result);